#ifndef PROTOCOL_PARSER_H
#define PROTOCOL_PARSER_H

#include <string>
#include <memory>
#include "message.h"

namespace network {

class ProtocolParser
{
public:
    enum class ParseState {
        HEADER,
        BODY,
        COMPLETE
    };
    
    ProtocolParser();
    
    ParseState parse(const char* data, size_t length);
    std::shared_ptr<Message> get_message() const;
    void reset();
    
private:
    std::shared_ptr<Message> current_message_;
    ParseState state_;
    size_t bytes_parsed_;
};

} // namespace network

#endif // PROTOCOL_PARSER_H    